package com.xcl.mapper;

import com.xcl.pojo.Article;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;


@Mapper
public interface ArticleMapper {

    //查询
    public List<Article> findArticle(@Param("categoryId") Integer categoryId,
                                     @Param("state") String state);


    //添加
    @Insert("insert into article (title,content,state,category_id,create_user,create_time,update_time) "  +
            " values (#{title},#{content},#{state},#{categoryId},#{createUser},now(),now())")
    public Integer addArticle(Article article);

    //修改
    @Update("update article set title=#{title},content=#{content},state=#{state},category_id=#{categoryId},update_time=now()"+
            " where id=#{id}")
    public Integer updateArticle(Article article);

}




